From: | Jonathan Day |
Date: | 24 Sep 2001 at 00:58:09 |
Subject: | Re: [amigactive] Re: html: how to close a window...? |
Hi Matt
> > I found an example:
> > <a href="javascript:window.close()">close me</a>
> >
> > but I've two problems with it, pressumably cos I've missed something:
> >
> > 1. In IE it brings up a message box saying: "the web page you are
viewing is
> > trying to close the window. Do you want to close the window?"
>
> This is good. Security reason.
That's okay then :-)
> If the window is opened by a script it can be closed by a script. If it
> is opened by a user or a normal link, it cannot be closed by script
> without user interaction.
Which would explain why the site I found the example from worked, it was
opened by a script.
> > 2. It only works like the above if i view the "banner" html page, i.e.
it
> > does not work (nothing happens) if viewing the page that combines the
banner
> > AND the page I'm linking to.
>
> ??
>
> If you want to specify a window to close you need to find out it's name,
or
> assign it to a variable:
>
> myWin = window.open("http://www.mysite.com/banner.html");
>
> and then myWin.close(); from the document that called it, or
window.close();
> from inside that document.
Hmmm. Thanks... I think, it's a bit more complicated than I thought it'd be.
I'll have a fiddle, I think I know what you're getting at.
> It isn't entirely clear what you want to do, you mixed and matched a few
terms
That's typical me, thanks for replying anyway :-)
> (and don't ever ever use frames unless some other site forces you since
you WILL
> be mauled by competant web developers :)
lol! I'd better watch out then, cos I only code the html for fun - putting
together a website for my dad's business
(http://www.ridingsmachineryring.co.uk) - and I dont have the time to sit
down with a book or 2 unfortunately.
I've put together a very small bit of html if you dont mind having a look,
it will explain what I'm trying to do.
http://www.users.totalise.co.uk/~jonday/links-test.html
If you can suggest another way to do this without using frames, I'll give it
a go. I'd also prefer it if the user does not have to confirm the close
window - so it looks like I'll have to use something like your example above
on the links page.
Cheers
Jon
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Pinpoint the right security solution for your company- Learn how to add 128- bit encryption and to authenticate your web site with VeriSign's FREE guide!
http://us.click.yahoo.com/JNm9_D/33_CAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->
Quote carefully and read all ADMIN:README mails
To unsubscribe mailto:amigactive-unsubscribe@yahoogroups.com
Anyone sending unsubscribe messages to the list will be SHOT!
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/